package main

import "fmt"

// 钱包
var moneyPacket float32

func main() {
	fmt.Println("开始")
	var name, pswd string
	fmt.Println("用户名")
	fmt.Scanln(&name)
	fmt.Println("密码")
	fmt.Scanln(&pswd)
	if login(name, pswd) {
		fmt.Println("余额:", moneyPacket)
		for i := 0; i < 3; i++ {
			var inputMoney float32
			fmt.Println("充值")
			fmt.Scanln(&inputMoney)
			chongzhi(inputMoney)
			fmt.Println("余额:", moneyPacket)
		}
	} else {
		fmt.Println("账号密码不对")
	}
}

//登录
func login(name, pswd string) bool {
	if name != "li" || pswd != "123456" {
		return false
	}
	return true
}

func chongzhi(money float32) {
	moneyPacket = moneyPacket + money

}
